﻿using System;
using System.Collections;
using System.Collections.Generic;

namespace Inovout.Data.Domain
{
    public abstract class TreeDataObject<TModel> : DataObject, ITreeDataObject<TModel> where TModel : class,ITreeDataObject<TModel>
    {

        protected TreeDataObject()
        {
            Children = new DataObjectChildrenSet<TModel>(this);
        }
        public virtual TModel Parent { get; set; }
        public virtual ISet<TModel> Children
        {
            get;
            private set;
        }




        object ITreeDataObject.Parent
        {
            get
            {
                return this.Parent;
            }
            set
            {
                this.Parent = (TModel)value;
            }
        }

        IEnumerable ITreeDataObject.Children
        {
            get { return this.Children; }
        }
    }
}
